/*
 * TagShort.cpp
 *
 *  Created on: 18 juin 2011
 *      Author: Pierrick Caillon <pierrick@megami.fr>
 */

#include "TagShort.h"

/* NAMEDTAG_H_ */
namespace NamedBinaryTag
{
    TagShort::TagShort()
    :NamedTag(), value(0)
    {
    }

    TagShort::~TagShort()
    {
    }

    void TagShort::set_Value(int16_t value)
    {
        this->value = value;
    }

    void TagShort::Write(std::ostream & output, bool ignoreName) const
    {
        NamedTag::Write(output, ignoreName);
        WriteData(output, (const char*)((&this->value)));
    }

    TagTypes TagShort::get_TagType() const
    {
        return TAG_SHORT;
    }

    void TagShort::Read(std::istream & input, bool ignoreName)
    {
        NamedTag::Read(input, ignoreName);
        ReadData(input, (char*)((&this->value)));
    }

    int16_t TagShort::get_Value() const
    {
        return this->value;
    }

    ITag *TagShort::clone() const
    {
    	return this->clone(NULL);
    }

    ITag *TagShort::clone(void *newRoot) const
    {
        TagShort *copy = new TagShort(newRoot);
        copy->value = this->value;
        return copy;
    }

}
